<?php
/**
 * Created by PhpStorm.
 * User: Vc_JiuMou
 * Date: 2018/9/14
 * Time: 22:53
 */

    function P($key){
        return $_POST[$key];
    }

    function G($key){
        return $_GET[$key];
    }

    function connectRedis(){
        static $redis = null;

        if($redis !== null){
            return $redis;
        }

        $redis = new Redis();
        $redis->connect('127.0.0.1');
        return $redis;
    }

    function error($msg){
        echo '<div>';
        echo $msg;
        echo '</div>';
        include('./footer.html');
        exit;
    }
    function success($msg,$url){
        echo '<div>';
        echo $msg.'3秒跳转到'.$url;
        echo '</div>';
        echo "<script>setTimeout(function (){window.location.href ='".$url."' },3000)</script>'";
        include('./footer.html');
        exit;
    }
    function checklogin(){
        if($_COOKIE['usernaem'] && $_COOKIE['userid']){
          return true;
        }
       return false;

    }